package com.bigmi.wemedia.controller.v1;

import com.bigmi.model.common.dtos.ResponseResult;
import com.bigmi.model.wemedia.dtos.WmMaterialDto;
import com.bigmi.model.wemedia.pojos.WmMaterial;
import com.bigmi.wemedia.service.WmMaterialService;
import org.junit.runners.Parameterized;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping("/api/v1/material")
public class WmMediaController {

    @Autowired
    WmMaterialService wmMaterialService;
    //图片上传
    @PostMapping("/upload_picture")
    public ResponseResult uploadPicture (MultipartFile multipartFile){
        return wmMaterialService.uploadPicture(multipartFile);

    }
    //素材列表查询
    @RequestMapping("/list")
    public ResponseResult findList(@RequestBody WmMaterialDto dto){
        return wmMaterialService.findList(dto);
    }
    //图片删除
    @GetMapping("/del_picture/{id}")
    public ResponseResult delPicture(@PathVariable int id){
        return wmMaterialService.delPicture(id);
    }
    //图片收藏
    @GetMapping("/collect/{id}")
    public ResponseResult collect( @PathVariable int id){
        return wmMaterialService.collect(id);
    }
    @GetMapping("/cancel_collect/{id}")
    public ResponseResult cancel_collect(@PathVariable int id){
        return wmMaterialService.cancel_collect(id);
    }


}
